package com.gadglet.gadgets.discussions.server.replay;

import java.util.Date;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.gadglet.core.GadgletRequestWrapper;
import com.gadglet.gadgets.discussions.server.DiscussionsList;
import com.google.appengine.api.datastore.Text;


@PersistenceCapable
public class Replys {
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;
	
	@Persistent
	private Text reply;
	
	@Persistent
	private String userName;
	
	@Persistent
	private Date cdate;
		
	@Persistent
	private String replyOrder;
	
	@Persistent
	private String replyTo;
	
	@Persistent
	DiscussionsList discussionsList;

	
	public Replys(GadgletRequestWrapper request, String replyMsg, String replyTo){
		this.userName = request.getCurrentUserId();
		this.cdate = new Date();
		this.reply = new Text(replyMsg);
		this.replyTo = replyTo;
		
	}
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String  getReply() {
		return reply.getValue();
	}

	public void setReply(String replay) {
		this.reply = new Text(replay);
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Date getCdate() {
		return cdate;
	}

	public void setCdate(Date cdate) {
		this.cdate = cdate;
	}

	public String getReplyOrder() {
		return replyOrder;
	}

	public void setReplyOrder(String replyOrder) {
		this.replyOrder = replyOrder;
	}

	public String getReplyTo() {
		return replyTo;
	}

	public void setReplyTo(String replayTo) {
		this.replyTo = replayTo;
	}
	

}
